//filename:kfifo.h
#ifndef _KFIFO_H_
#define _KFIFO_H_

//#include "soc_types.h"
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

typedef struct kfifo 
{
    unsigned char *buffer;/* the buffer holding the data*/
    unsigned int size;/* the size of the allocated buffer*/
    unsigned int in;/* data is added at offset (in % size)*/
    unsigned int out;/* data is extracted from off. (out % size)*/
}kfifo_t;

extern int kFifoInit(kfifo_t *fifo, unsigned char *buffer, unsigned int size);
extern unsigned int kFifoPut(kfifo_t *fifo, unsigned char *buffer, unsigned int len);
extern unsigned int kFifoGet(kfifo_t *fifo, unsigned char *buffer, unsigned int len);
extern unsigned int kFifoPeer(kfifo_t *fifo, unsigned char *buffer, unsigned int len);
extern void kFifoReset(kfifo_t *fifo);
extern unsigned int kFifoLen(kfifo_t *fifo);
extern unsigned int kFifoAviable(kfifo_t *fifo);
extern unsigned int kFifoFull(kfifo_t *fifo); //full 1
extern unsigned int kFifoEmpty(kfifo_t *fifo); //empty 1

#endif
